package com.develop.skwen.electricgomall.util;

import android.support.v4.app.Fragment;

import com.develop.skwen.electricgomall.R;
import com.develop.skwen.electricgomall.category.CategoryFragment;
import com.develop.skwen.electricgomall.find.FindFragment;
import com.develop.skwen.electricgomall.home.HomeFragment;
import com.develop.skwen.electricgomall.mine.MineFragment;
import com.develop.skwen.electricgomall.model.MainData;
import com.develop.skwen.electricgomall.paycar.PayCarFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by skwen
 * on 18-5-29
 */

public class MainDataUtil {


    private String[] mainNames = {"首页", "分类", "发现", "购物车", "我的"};

    private int[] mainIcons = {R.mipmap.home_icon,
            R.mipmap.category_icon,
            R.mipmap.recommend_icon,
            R.mipmap.paycar_icon,
            R.mipmap.mine_icon};

    private Fragment[] mainFragments = {new HomeFragment(), new CategoryFragment(), new FindFragment(), new PayCarFragment(), new MineFragment()};

    private static MainDataUtil sMainDataUtil;

    private MainDataUtil() {

    }

    public static MainDataUtil getInstance() {
        if (sMainDataUtil == null) {
            sMainDataUtil = new MainDataUtil();
        }
        return sMainDataUtil;
    }


    public List<Fragment> getListFragment() {
        List<Fragment> list = new ArrayList<>();
        list.add(new HomeFragment());
        list.add(new CategoryFragment());
        list.add(new FindFragment());
        list.add(new PayCarFragment());
        list.add(new MineFragment());
        return list;
    }


    public List<MainData> getListMainData() {
        List<MainData> list = new ArrayList<>();

        for (int i = 0; i < mainNames.length; i++) {
            MainData mainData = new MainData();
            mainData.setName(mainNames[i]);
            mainData.setIds(mainIcons[i]);
            list.add(mainData);
        }

        return list;
    }


}
